<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>
<body>

    <div id="demo">
        <h2>{{message }}</h2>
        <h2>{{ok}}</h2>
        <h2>{{ number }}</h2>
    </div>

    <script>
        function MyDemo(options){
            this.options=options;
            this.el=this.options.el;
            this.data=this.options.data;
            this.root=document.querySelectorAll(this.el)[0];//根节点

            this.init=function(){
                for(var key in this.data){
                    this[key]=this.data[key];
                    this.root.innerHTML=this.root.innerHTML.replace(new RegExp("{{"+" {0,}"+key+" {0,}"+"}}"),this[key])
                }
            }

            this.init();
        }

        new MyDemo({
            el:"#demo",
            data:{
                number:123123,
                ok:"端午端午",
                message:"六一六一"
            }
        })

    </script>
</body>
</html>